<!DOCTYPE html>
<html>
<head>
    <title>查询历史电报</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="commission.js"></script>
</head>
<body>
<center>
<?php
$searchdate1=$_POST['date1'];
$searchdate2=$_POST['date2'];
session_start();
$id=$_SESSION['userid'];
$conn = new mysqli("localhost", "root", "123", "commission");
if ($conn->connect_error) {
    die("服务器连接失败: " . $conn->connect_error);
}
$result = $conn->query("SELECT * FROM salesinformation where id = '".$id."' and date >= '".$searchdate1."' and date <= '".$searchdate2."'");
if ($result->num_rows > 0) {
?>
<div id="content" class="row" style="margin: 2% 6% 1%;width:90%;">
    <div class="table-responsive">
        <table class="table">
            <thead>
                <tr>
                <th>电报单号</th>
                <th>人员编号</th>
                <th>发报日期</th>
                <th>城市</th>
                <th>lock</th>
                <th>sock</th>
                <th>barrel</th>
                </tr>
            </thead>
            <tbody >
<?php
    while($row=$result->fetch_assoc())
    {
?>
                <tr>
                <td><?php echo $row['number']?></td>
                <td><?php echo $row['id']?></td>
                <td><?php echo $row['date']?></td>
                <td><?php echo $row['city']?></td>
                <td><?php echo $row['locks']?></td>
                <td><?php echo $row['stocks']?></td>
                <td><?php echo $row['barrels']?></td>
                </tr>
<?php
    }
}
else {
    echo "没有查找到历史记录";
}
$conn->close();
?>
            </tbody>
        </table>
    </div>
</div>
</center>
</body>
</html>
